import React, { useEffect, useState } from 'react'
import PersonStore from '../store/Person'

function updateName(){
   if(PersonStore.name !== ""){
    return true;
   }
   return false
  
}

function Person() {
  const [name,setName] = useState("张三")
  console.log(1);
  const flag = updateName()
  console.log(flag);
  useEffect(() => {
    console.log(2);
    PersonStore.setName("LISI")
  }, [])
  return (
    <div>
        {flag && <div>你好</div>}
        {PersonStore.name}
        <button onClick={() => {
            setName("里斯")
        }}>点击</button>
    </div>
  )
}

export default Person